//
//  GSComomLoginChildController.m
//  GSLoginDemo
//
//  Created by guoshikeji_a on 2018/7/27.
//  Copyright © 2018年 guoshikeji. All rights reserved.
//

#import "GSComomLoginChildController.h"

#import "UILabel+GSCommonLabel.h"

@interface GSComomLoginChildController ()

@end

@implementation GSComomLoginChildController

- (GSCommonLoginButton *)nextStepButton {
    if (!_nextStepButton) {
        _nextStepButton = [GSCommonLoginButton new];
        [_nextStepButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_nextStepButton setTitle:GSLoginLocalized(@"Next Step") forState:UIControlStateNormal];
        _nextStepButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightRegular];
        [_nextStepButton addTarget:self action:@selector(nextStepButtonDidClickedAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _nextStepButton;
}

- (GSCommonLoginButton *)doneButton {
    if (!_doneButton) {
        _doneButton = [GSCommonLoginButton new];
        [_doneButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_doneButton setTitle:GSLoginLocalized(@"Done") forState:UIControlStateNormal];
        _doneButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightRegular];
        [_doneButton addTarget:self action:@selector(doneButtonDidClickedAction) forControlEvents:UIControlEventTouchUpInside];
    }
    return _doneButton;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    //
    [self setupChildSubviews];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)setupChildSubviews {
    self.largeTitleLabel = [UILabel commonLargeTitleLabel];
    [self.view addSubview:self.largeTitleLabel];
    [self.largeTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.customNaviBar.mas_bottom).offset(22.0);
        make.left.mas_equalTo(self.view).offset(20.0);
        make.right.mas_equalTo(self.view).offset(-20.0);
    }];
    //
    self.subTitleLabel = [UILabel subTitleLabel];
    [self.view addSubview:self.subTitleLabel];
    [self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.largeTitleLabel.mas_bottom).offset(1.0);
        make.left.mas_equalTo(self.view).offset(20.0);
        make.width.mas_lessThanOrEqualTo(self.view).offset(-40.0);
    }];
}

- (void)nextStepButtonDidClickedAction {
    [self.view endEditing:true];
}
- (void)doneButtonDidClickedAction {
    [self.view endEditing:true];
}

@end
